package com.s64.ch08.config;

import com.s64.service.LinuxListService;
import com.s64.service.WindowsListService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig {

    @Bean
    @ConditionalOnProperty(prefix = "s63", name = "list", havingValue = "ls", matchIfMissing = true)
//    @Conditional(LinuxConditional.class)
    public LinuxListService linuxListService() {
        return new LinuxListService();
    }

    @Bean
//    @Conditional(WindowsConditional.class)
    @ConditionalOnProperty(prefix = "s63", name = "list", havingValue = "dir")
    public WindowsListService windowsListService() {
        return new WindowsListService();
    }
}
